package com.zzz.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

/**
 * @author zhuzhizun
 * @date 2021/8/13
 */
@Aspect
@Component
public class TestAspect {


    @Pointcut("execution(* com.zzz.service.TestServiceImpl.*(..))")
    public void testPointCut()
    {

    }

    @Before("testPointCut()")
    public void doBefore(JoinPoint point) throws Throwable
    {
        System.out.println("参数名---------: "+point.getArgs().toString());
        Signature signature = point.getSignature();
        MethodSignature methodSignature = (MethodSignature) signature;
        System.out.println("方法名---------: "+methodSignature.getMethod().getName());
        System.out.println("执行之前");
    }

}
